function stimactivity  = getcellstimactivity(ExpID,roiID)
[activity, oris, eyes]  = getcellactivity(ExpID,roiID);
if length(activity) > 10
    if length(activity) == length(eyes) &&  length(activity) == length(oris)
        eyelist = sort(unique(eyes));
        orilist = sort(unique(oris));
        repmap = zeros(length(eyelist), length(orilist));
        actmap = zeros(length(eyelist), length(orilist));
        ieye = 0;
        iori = 0;
        iact = 0;
        for i=1:length(activity)
            if ~(ieye == find(eyelist == eyes(i)) && iori ==  find(orilist == oris(i))) % same stim as last one
                repmap(find(eyelist == eyes(i)), find(orilist == oris(i))) = repmap(find(eyelist == eyes(i)), find(orilist == oris(i))) +1;
            end
            actmap(find(eyelist == eyes(i)), find(orilist == oris(i))) = actmap(find(eyelist == eyes(i)), find(orilist == oris(i))) +1;
            ieye = find(eyelist == eyes(i)) ;
            iori =  find(orilist == oris(i));
        end
        if isempty(find(diff(actmap)~=0)) && isempty(find(diff(repmap)~=0))
            if mod(actmap(1), repmap(1)) == 0
                nact = actmap(1) / repmap(1);
                nrep = repmap(1);
                stimactivity = NaN(length(eyelist), length(orilist), nrep, nact);
                repmap(:,:) = 1;
                for i=1:length(activity)
                    if ~(ieye == find(eyelist == eyes(i)) && iori ==  find(orilist == oris(i))) % same stim as last one
                        iact = 1;
                    else
                        iact = iact + 1;
                    end
                    if ~(isnan(stimactivity(find(eyelist == eyes(i)), find(orilist == oris(i)),  repmap(find(eyelist == eyes(i)), find(orilist == oris(i))), iact)))
                         repmap(find(eyelist == eyes(i)), find(orilist == oris(i))) =  repmap(find(eyelist == eyes(i)), find(orilist == oris(i)))+1;
                    end
                    stimactivity(find(eyelist == eyes(i)), find(orilist == oris(i)),  repmap(find(eyelist == eyes(i)), find(orilist == oris(i))), iact) = activity(i);
                    ieye = find(eyelist == eyes(i)) ;
                    iori =  find(orilist == oris(i));
                end
                
            else
                disp('Repititions are not nice:')
                actmap
                repmap
                actmap(1) / repmap(1)
                stimactivity = [];
            end
        else
            disp('Data is not well shaped:')
            actmap
            repmap
            ExpID
            roiID
            frames = length(activity)
            stimactivity = [];
        end
        %stimactivity = [];
        %stimactivity(find(eyelist == eyes(i)), find(orilist == oris(i))) = activity(i);
    else
        stimactivity = [];
    end
else
    stimactivity = [];
end
